POV-Ray : Newsgroups : povray.programming : this : Re: this Server Time
28 Jul 2024 16:24:25 EDT (-0400)
  Re: this  
From: Thorsten Froehlich
Date: 25 Jun 2002 12:21:08
Message: <3d189874@news.povray.org>
In article <pan### [at] maccom> , Christopher James
Huff <chr### [at] maccom>  wrote:

>> If you carefully consider the scope in either case you will notice that
>> there is no other than the "this" or "self" (or whatever you call it)
>> scope, so no need for it as keyword to specify the only available scope.
>>  In particular because every attribute of the object would be a reserved
>> name anyway, so no need to disambiguate between local and global
>> variables either.  Essentially what I am pointing out is that the
>> concept of "this" or "self" simply does not apply to POV-Ray SDL.
>
> I don't understand what you mean...it doesn't have anything to do with
> disambiguating scope, it would be a symbol for the shape currently being
> parsed. It has an equivalent in the current language, it's just a
> shortcut, so I don't know how it doesn't apply.

You just don't need it.  If you think about it, what is the "this" pointer
in C++ for?  To access members without having to use lengthy specification
of the exact scope you are working on.  But why would you want to have to
write "self.radius = 1" if you could just as well implement it such that you
can write "radius = 1"?

Or do you always write "this->foo_member" inside a C++ member function?

> Sounds interesting, but I think you need to explain a bit more. Do you
> mean using a VM for everything instead of the current direct parser, but
> using a syntax somewhat similar to what there is now, or are you talking
> about making a functional language like Lisp or Scheme?

No, more in the spririt of POV-Ray give full access to everything.  Imagine
you could replace every expression with one i.e. depending on clock, the
parser would automatically recognize it and apply it dynamically.  No more
parsing of the whole scene.  The same would apply when rendering a single
frame.  Only after parsing (also that tehcnically isn't at render time but
just before it) the expression would be evaluated.  Of it could be any
function you insert.

Given an intelligent enough parser it is even be possible to allow
substitution of any block-level element with "code like a function" (I
intentionally want to leave the specific definition of this open).  As it
woudl effectively allow substitution of anything in an object by aosmething
declared, there would be no more need for a "self" or "this" because as soon
as you insert the function it automatically knows which context it is in.


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.